﻿<?php
session_start();

if (!isset($_SESSION['login']) && !$_SESSION['login'] == true) {
	header ("Location: index.php");
}

if(isset($_GET['ID']))
{
	$id = $_GET['ID'];
}
else
{
	header ("Location: listinnovation.php");
}

include 'config.php';

mysqli_set_charset($con, 'utf8');

?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<link rel="stylesheet" type="text/css" href="style.css" />
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="scripts/jquery.tablesorter.js"></script>
<script src="scripts/lang/lang_se.js"></script>

<title>Sales Makeover</title>
</head>

<body>
	<div class="bodyLeft" id="bodyLeft">
		<?php include("menu.html"); ?>
	</div>
	<div class="bodyRight" id="bodyRight">
		<div class="container_head">
			<?php include("header.html"); ?>
		</div>
		<div class="container" id="container">
			<div class="content">			
				<?php
				
				$sql = "SELECT Innovation.CustomerName,Innovation.ContactName, Innovation.Name, Innovation.Created, Innovation.Recommendation, Innovation.Problem, Innovation.Solution, Innovation.CustomerValue, Innovation_NextStep.Value AS NextStep, Innovation_TimeFrame.Value AS TimeFrame, User.Name AS UserName, Innovation_Role.Value as InnoRole FROM Innovation INNER JOIN Innovation_NextStep ON Innovation_NextStep.ID = Innovation.NextStepID INNER JOIN Innovation_TimeFrame ON Innovation_TimeFrame.ID = Innovation.TimeFrameID INNER JOIN Innovation_Role ON Innovation_Role.ID = Innovation.OwnerRoleID INNER JOIN User ON User.ID = Innovation.OwnerID WHERE Innovation.ID = '$id'";
				
				
				$result = mysqli_query($con,$sql);
				
				$row = mysqli_fetch_array($result);
				
				echo "<div style='border-bottom: 1px solid #333333;text-align:center;width:90%;margin-left:auto;margin-right:auto;'>";
					echo "<p>" . $row['CustomerName'] . "</p>";
					echo $row['Name'];
					echo "<br>";

					echo "<p style='font-size:10px; display: inline-block;' class=\"tr\" key=\"show_Created\"></p>";
					echo "<p style='font-size:10px;margin-left:2px; display: inline-block;' > " . $row['UserName'] . "</p>";
					echo "<p style='font-size:10px; margin-left:2px; display: inline-block;' class=\"tr\" key=\"show_On\"></p>";
					echo "<p style='font-size:10px;margin-left:2px; display: inline-block;' >" . $row['Created'] . "</p>";
					
				echo "</div>";
				
				echo "<div style='border-bottom: 1px solid #333333;width:90%;margin-top:15px;margin-left:auto;margin-right:auto;'>";
					echo "<div style='padding-left:10px;'>";
						echo "<b><div class=\"tr\" key=\"show_Contact\"></div></b>";
						echo $row['ContactName'] . "<br/>";
						echo $row['InnoRole'];
						echo "<br/><br/>";
						echo "<b><div class=\"tr\" key=\"show_Recommendation\"></div></b>";
						echo $row['Recommendation'];
						echo "<br/><br/>";
						echo "<b><div class=\"tr\" key=\"show_Problem\"></div></b>";
						echo $row['Problem'];
						echo "<br/><br/>";
						echo "<b><div class=\"tr\" key=\"show_Solution\"></div></b>";
						echo $row['Solution'];
						echo "<br/><br/>";
					echo "</div>";
				echo "</div>";
				
				echo "<div style='width:90%;margin-top:15px;margin-left:auto;margin-right:auto;'>";
					echo "<div style='padding-left:10px;'>";
						echo "<b><div class=\"tr\" key=\"show_Value\"></div></b>";
						echo $row['CustomerValue'];
						echo "<br/><br/>";
						echo "<b><div class=\"tr\" key=\"show_NextStep\"></div></b>";
						echo $row['NextStep'];
						echo "<br/><br/>";
						echo "<b><div class=\"tr\" key=\"show_Timetable\"></div></b>";
						echo $row['TimeFrame'];
						echo "<br/><br/>";
					echo "</div>";
				echo "</div>";
				
				echo "<div class='button' style='margin-left:auto;margin-right:auto;margin-bottom:20px;' onclick=\"javascript:document.location.href = 'listinnovation.php'\"><span style='line-height:36px;' class=\"tr\" key=\"show_Ok\"></span></div>";
				
				mysqli_close($con);
				
				?>
			</div>
		</div>
	</div>
</body>

</html>